package cays.student.dao;

import cays.student.vo.Sc;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * 选课信息接口
 */
public interface ScDao {
    @Select("select * from sc")
    List<Sc> getAllSc();
    @Select("select * from sc where sno=#{sno} and cno=#{cno}")
    Sc getScBySnoAndCno(@Param("sno") String sno, @Param("cno") String cno);

    @Update("<script>update sc<set>" +
            "<if test='grade != null'>grade=#{grade},</if></set>" +
            "<where>" +
            "<if test='sno != null'>and sno=#{sno}</if>" +
            "<if test='cno != null'>and cno=#{cno}</if></where>" +
            "</script>")
    int updateScBySnoAndCno(Sc sc);
    @Insert("insert into sc values (#{sno},#{cno},#{grade})")
    int insertSc(Sc sc);
    @Delete("delete sc where sno=#{sno} and cno=#{cno}")
    int deleteScBySnoAndCno(@Param("sno") String sno, @Param("cno") String cno);
}
